package com.lqk.strategy.improve;

/**
 * @author lqk
 * @date 2021/12/13 13:15
 */
public abstract class Duck {

    // 属性，策略接口
    FlyBehavior flyBehavior;


    public Duck() {
    }
    public abstract void display(); // 显示鸭子的信息
    public void quack(){
        System.out.println("鸭子嘎嘎叫~~~");
    }
    public void swim(){
        System.out.println("鸭子会游泳~~~");
    }
    public void fly(){
        if (flyBehavior != null){
            flyBehavior.fly();
        }
    }
}
